#include<bits/stdc++.h>
#define int long long 

using namespace std;

int zh(int x) {
	int t = 0;
	if(x == 0) {
		t ++ ;
	}
	while(x) {
		t ++ ;
		x /= 10;
	}
	return t;
}

signed main() {
	int ret = 0;
	int n, c;
	cin >> n >> c;
	n -= 2;
	n -= zh(c);
	for(int i = 0; i <= c; i ++ ) {
		if(zh(i) + zh(c - i) == n) {
			ret ++ ;
		}
	}
	
	cout << ret << endl;
	return 0;
}

